/!\ WARNING : The rom is not included and the english translated patch released won't work with those tools. To produce a english translated rom compatible with those
tools, you need to have the japanese version of the rom (often named "Crystal Beans From Dungeon Explorer (J).smc", CRC32 : 79663A93, size : 1 572 864 bytes).

Once you have it, patch the japanese rom with the IPS patch named "CB_english_translated_version_1-1.ips". Once patched, the rom will be in english (CRC32 : 93C106FC,
size : 2097152 bytes). Now, renamed the patched rom with this new name "CB_english_translated_version_1-1.smc" (same as the IPS name, but with .smc instead of .ips)
or the tools won't work. Now, you can use the tools /!\

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

One thing before starting the explanations. Each .bat file is linked with a .lua.txt file, here's how to read the commands:

For Extraction :

extraire("CB_english_translated_version_1-1.smc", "CB_main_script_us.tbl", "CB_main_script_us.txt", 0x180000, 0x188D34, 0x3E402, 308, 3, "X-$C00000", little_endian)

("name of the rom, "name of the table", "name of the dumped text file", "start of the text adress", "end of the text adress", "start of the pointer table adress", 
"number of pointers", "length of the pointers, 2 = 16-bits, 3 = 24-bits", "calculation of the pointers", "little endian or big endian")

For Insertion :

inserer("CB_english_translated_version_1-1.smc", "CB_main_script_us.tbl", "CB_main_script_us.txt", 0x180000, 0x1FDFFF, 0x3E402, 308, 3, "X+$C00000", little_endian)

("name of the rom, "name of the table", "name of the dumped text file", "start of the text adress", "end of the block/bank where the text can be inserted", "start of 
the pointer table adress", "number of pointers", "length of the pointers, 2 = 16-bits, 3 = 24-bits", "calculation of the pointers", "little endian or big endian")

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

1) "CB_extract_main_script_us.bat" & "CB_extract_main_script_us.lua.txt"

Run the .bat to extract the main script from the rom. Note that if you reinsert a bigger script than the original one, you'll have to change the address "0x1FDFFF"
in the .lua.txt file. But the main script is already dumped ("CB_main_script_us.txt") so you won't really need it.

2) CB_insert_main_script_us.bat

Run the .bat to insert the main script in the rom. The english main script size is 51.9 kb and the inserter can handle a script big of ~530 kb thanks to the expansion
(12 to 16 MB) so you don't really have to be shy about the translation length and don't have to constrain yourself.

3) "CB_extract_places_names_script_us.bat" & "CB_extract_places_names_script_us.lua.txt"

Same as 1) The script is already dumped, name : "CB_places_names_script_us.txt"

4) "CB_insert_places_names_script_us.bat" & "CB_insert_places_names_script_us.lua.txt"

Run the .bat to insert the place names script in the rom. The english place names script size is 0.18 kb and the inserter can handle a script big of ~2.8 kb thanks
to the expansion (12 to 16 MB) so you don't really have to be shy about the translation length and don't have to constrain yourself. I could have permitted a bigger
script but it's just a few place names so you won't even really need near 3 kb as the size of each place name is limited because of the window's size of the screen.

The _ sign are space in the game, I just put _ instead because it's better in terms of visibility. The actual place names are centered, but as the font use a VWF,
there is no really a proper way to center them. Just try and reinsert the script in the rom, and adjust from what you see. I added a ZSNES savestate (didn't put
a BSNES-only savestate in case it demotivate some peoples to translate the game, who knows :o) named "CB_english_translated_version_1-1.zst" (so "Slot 0") to help
center the names. Just load it, exit the screen by going at the bottom and the map will appear with all the locations unlocked. Check your modifications, re-center
the names if needed. Reload the rom then the savestate and you can see your modifications in a few seconds, etc...

5) "CB_extract_intro_ending_staff_us.bat" & "CB_extract_intro_ending_staff_us.lua.txt"

Same as 1) The script is already dumped, name : "CB_intro_ending_staff_us.txt"

6) "CB_insert_intro_ending_staff_us.bat" & "CB_insert_intro_ending_staff_us.lua.txt"

Run the .bat to insert the intro/ending/staff script in the rom. The english intro/ending/staff script size is 6.49 kb and the inserter can handle a script big
of ~25 kb thanks to the expansion (12 to 16 MB). Unfortunately, it won't really help much as you can't add more lines in the window's text (except the ones which
are  on a black background, as there isn't any windows text)

7) Four texts remains after those modifications, and we'll modify them manually (each text would require a script to extract them so it's pretty useless).
Here's the adresses of the texts (use "Hex Workshop" to modify them, as the encode of the text is ASCII) :

- 0x1FE000 : "Select the numbers of players." (You can go until "0x1FE06F" for this sentence, make it end with a "00" byte).
- 0x1FE070 : "Continue?" (You can go until "0x1FE0FF" for this sentence, more in fact but that's pretty useless for only one word, make it end with a "00" byte").

- 0x9887 : "1P    2P    3P" (I assume you'll just after to modify the P with another letter, but you can also shift both characters if needed, like "P1    P2    P3"
for example, keep the other bytes as they are).

- 0x986C : "Yes    No" (You can use the extra "00" bytes" if you want to put longer words. Right now, the bytes are :

1F 59 65 73 1F 1F 1A 4E 6F 00 00 00 00 00 00
   Y  E  S           N  O

I don't think you'll have to modify the pointer, the room for this sentence seems enough for any language (just two words), but if you really need to move this
sentence, the pointer is at 0x9869 ("6C 98", the adress, 0x986C, reversed). Anyway, what's interest us is the length of the sentence (if you add some characters
without changing the byte which indicate the length of the sentence to the game, the added characters won't show up in the game).

The length is at 0x986B ("0A"). Add +1 (hexadecimal) for each added character. For example, if you added two more characters after the "No" word, you have
to replace "0A" with "0C".

8) If you need to modify the font of the intro/ending/staff text (to add missing special characters, for example), you can use 
"CB_extract_intro_ending_staff_font_12x12_us.bat".  The actual font is already dumped in the file "CB_opening_ending_staff_font-12x12.bmp". You can modify it
with a graphic editor like Paint (just be sure to not modify the palette/number of colors of the image) and reinsert it with the file 
"CB_insert_intro_ending_staff_font_12x12_us.bat".

9) If you need to modify the font of the dialog texts (to add missing special characters, for example), just use a graphic tile editor like TileMolester or such. 

In TileMolester, the font is at the adress 0x4649B and use the codec "1bpp planar".

10) If you need to modify the graphics class names of the characters ("Fighter/Priest/Bard/etc..."), use "CB_extract_class_names_and_menus_graphic_us.bat"
to extract it (but it's already extracted, name : "CB_classes_names_graphic_us.bin"), modify the extracted file with a graphic tile editor like TileMolester or such.
In TileMolester, use the default codec ("2bpp planar") to edit the image. Once edited, save it and reinsert the edited file using 
"CB_insert_classes_names_graphics_us.bat".

11) If you need to modify most of the words in the menus (stats and such), use "CB_extract_menus_and_stats_graphics_us.bat"
to extract it (but it's already extracted, name : "CB_menu_and_stats_graphics_us.bin"), modify the extracted file with a graphic tile editor like TileMolester or such.

In TileMolester, use the default codec ("2bpp planar") to edit the image. Once edited, save it and reinsert the edited file using "CB_menu_and_stats_graphics_us.bin".

12) If you need to modify the 1P/2P/3P cursors graphics at the beginning of the game (when you choose the character for each player), 
use "CB_extract_1P_cursor_graphic_us.bat" (for the "1P" cursor) to extract it (but it's already extracted, name : "CB_1P_cursor_graphic_us.bin"), modify the extracted 
file with a graphic tile editor like TileMolester or such.

In TileMolester, use the codec "4bpp planar, composite (2x2bpp) to edit the image. Once edited, save it and reinsert the edited file using 
"CB_insert_1P_cursor_graphic_us.bat".

Note : Do the same for "2P" and "3P" cursors, the name of the files are the same except "1P" is replaced by "2P" and "3P".

13) If you need to modify the title screen and "PUSH START" graphics at the beginning of the game, use "CB_extract_title-screen_and_push-start_graphics_us.bat" 
to extract it (but it's already extracted, name : "CB_title-screen_and_push-start_graphic_us.bmp"), modify the extracted file with a graphic tile editor like 
TileMolester or such.

In TileMolester, use the codec "4bpp planar, composite (2x2bpp) to edit the image. Once edited, save it and reinsert the edited file using 
"CB_insert_title-screen_and_push-start_graphics_us.bat".

14) If you need to modify the "THE END" graphic during the staff roll, use "CB_extract_the-end_graphic_us.bat" to extract it (but it's already extracted, 
name : "CB_the-end_graphic_us.bin"), modify the extracted file with a graphic tile editor like TileMolester or such.

In TileMolester, use the codec "4bpp planar, composite (2x2bpp) to edit the image. Once edited, save it and reinsert the edited file using 
"CB_insert_the-end_graphic_us.bat".

15) If you need to modify the translation copyrigths grahics ("HIEI-, NEIGE" & "ENGLISH V1.0") on the title screen,
use "CB_extract_translation_copyrights_graphics_us.bat" to extract it (but it's already extracted, name : "CB_translation_copyrights_graphic_us.bin"),
modify the extracted file with a graphic tile editor like TileMolester or such.

In TileMolester, use the codec "4bpp planar, composite (2x2bpp) to edit the image. Once edited, save it and reinsert the edited file using 
"CB_insert_the-end_graphic_us.bat".


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here's a quick summary of the explanations :

- Translate "CB_main_script_us.txt", reinsert it with "CB_insert_main_script_us.bat".
- Translate "CB_places_names_script_us.txt", reinsert it with "CB_insert_places_names_script_us.bat"
- Translate "CB_intro_ending_staff_us.txt", reinsert it with "CB_insert_intro_ending_staff_us.bat.
- Modify manually the four remaining sentences => Check 7) for more informations about it.

- Modiy "CB_classes_names_graphic_us.bin", reinsert it with "CB_insert_classes_names_graphics_us.bat"
- Modiy "CB_menu_and_stats_graphics_us.bin", reinsert it with "CB_insert_menus_and_stats_graphics_us.bat"
- Modiy "CB_the-end_graphic_us.bin", reinsert it with "CB_insert_the-end_graphic_us.bat"
- Modiy "CB_title-screen_and_push-start_graphic_us.bin", reinsert it with "CB_insert_title-screen_and_push-start_graphics_us.bat"
- Modify "CB_translation_copyrights_graphic_us.bin", reinsert it with "CB_insert_translation_copyrights_graphics_us.bat"
- Modify "CB_1P_cursor_graphic_us.bin", "CB_2P_cursor_graphic_us.bin" and "CB_3P_cursor_graphic_us.bin". Reinsert them with "CB_3P_cursor_graphic_us.bin", 
"CB_insert_2P_cursor_graphic_us.bat" and "CB_insert_3P_cursor_graphic_us.bat".

- Modify the fonts if needed, see 8) and 9) for more informations about it.

Then, you're done, you have a translated version of "Crystal Beans : From Dungeon Explorer" in your own language.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Other files included in the archive :

Savestates (ZSNES) :

- Savestate 0 : All locations unlocked on the world map. Just exit the castle from the bottom to display the world map.
You can also use this savestate to go back to Rubens' Castle and check all the books in the library.

- Savestate 1 : Before the grow of the Crystal Beans (there is a cutscene with some texts just after).

- Savestate 2 : Facing the last boss. You only need to use the magic attack once (R button) to kill him.

- Savestate 3 : Before displaying the staff of the game.

Cheats (ZSNES) :

CB_english_translated_version_1-1.cht : Infinites HP, White and Black Potions.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

With all of this, you should be able to translate this game in your language. If you have any questions/need help, don't hesitate to post on this thread :
http://www.romhacking.net/forum/index.php/topic,13519.0.html and I'll help you as much as I can.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hiei- (scripts-elysion@hiei-tf.fr)
